package ca.qc.bdeb.info.pp2.tp2.controleur;

import ca.qc.bdeb.info.pp2.tp2.application.Facade;
import ca.qc.bdeb.info.pp2.tp2.application.VendreProprieteBean;
import javax.servlet.http.HttpServletRequest;

public class CommandeVendreProprietes implements Commande
{
    private String next;

    public CommandeVendreProprietes(String next)
    {
        this.next = next.toLowerCase();
    }

    @Override
    public String executer(HttpServletRequest req) throws CommandeException
    {
        Facade f = new Facade();
        VendreProprieteBean pbean = new VendreProprieteBean();

        pbean.setPrenom(req.getParameter("prenom"));
        pbean.setNom(req.getParameter("nom"));
        pbean.setNumero_telephone(req.getParameter("numero"));
        pbean.setCourriel(req.getParameter("courriel"));
        pbean.setAdresse(req.getParameter("adresse"));
        pbean.setQuartier(req.getParameter("quartier"));
        pbean.setVille(req.getParameter("ville"));
        pbean.setProvince(req.getParameter("province"));
        pbean.setPays(req.getParameter("pays"));
        pbean.setCommentaire(req.getParameter("commentaire"));

        f.setVendrePropriete(pbean);
        return next;
    }
}
